import Vue from 'vue'
import request from '@/itsoftUI/utils/request'
import qs from "qs";
const baseUrl = Vue.prototype.$itsoftUI.config.serviceUrl + "/apartment";
const baseUrls = Vue.prototype.$itsoftUI.config.serviceUrl + "/manager";
//房间管理
const apiRoom = {
    //房间信息数据导入
    ImportRoomData: function (dataList, queryList, pageIndex, totalPages) {
        const data = {
            dataList, queryList, pageIndex, totalPages
        }
        return request({
            url: baseUrl + '/manageRoom/importRoomData',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //学生信息数据导入
    ImportRoomDataValidate: function (dataList, queryList, pageIndex, totalPages) {
        const data = {
            dataList, queryList, pageIndex, totalPages
        }
        return request({
            url: baseUrl + '/manageRoom/importRoomDataValidate',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    getTreeList: function (areaId, buildingId) {
        const data = { areaId, buildingId }
        return request({
            url: baseUrl + "/manageRoom/getTreeList",
            method: "post",
            data: qs.stringify(data)
        });
    },
    List: function (page, search, order, searchValue) {
        const data = { page, search, order, searchValue };
        return request({
            url: baseUrl + "/manageRoom/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    getManageDictionaryDetailList: function (search) {
        const data = { search };
        return request({
            url: baseUrl + "/manageDictionaryDetail/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 楼宇管理 信息对象
    getManageBuilding: function (id) {
        const data = { id };
        return request({
            url: baseUrl + "/manageBuilding/get",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 添加或编辑房间管理
    Edit: function (data) {
        const config = {
            headers: {
                'Content-Type': 'application/json;charset=utf-8'
            },
        }
        return request.post(baseUrl + "/manageRoom/save", data, config)
    },
    // 批量添加
    batchAdd: function (data) {
        const config = {
            headers: {
                'Content-Type': 'application/json;charset=utf-8'
            },
        }
        return request.post(baseUrl + "/manageRoom/saveRooms", data, config)
    },
    //删除房间信息
    delete: function (ids) {
        const data = { ids };
        return request({
            url: baseUrl + "/manageRoom/delete",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 学校管理信息
    getSchoolList: function (id) {
        const data = { id };
        return request({
            url: baseUrls + "/school/list",
            method: "post",
            data: qs.stringify(data)
        });
    },
    // 房间列表左侧树
    getBuildingTree: function (level) {
        const data = { level };
        return request({
            url: baseUrl + "/manageRoom/getBuildingTree",
            method: "post",
            data: qs.stringify(data)
        });
    },
}
export {
    apiRoom
}